package com.example.dianproject.dto;

import com.example.dianproject.entity.UserRole;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class LoginResponse {
    private Long userId;
    private String username;
    private UserRole role;
    private String token;  // 预留token字段，后续可用于JWT认证
    private boolean success;
    private String message;
    
    public static LoginResponse success(Long userId, String username, UserRole role) {
        return new LoginResponse(userId, username, role, null, true, "登录成功");
    }
    
    public static LoginResponse error(String message) {
        return new LoginResponse(null, null, null, null, false, message);
    }
} 